<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ca="http://java.sun.com/jsf/composite/cashSummery"
                xmlns:pe="http://primefaces.org/ui/extensions">

    <ui:define name="content">
        <h:form>
            <p:panel id="panelPrint" styleClass="noBorder summeryBorder">
                <f:facet name="header" >
                    <p:outputLabel value="#{sessionController.institution.name}"/> <br/>
                    <p:outputLabel value="Daily Summary Report Category"/>
                    <p:commandButton value="Refresh" ajax="false"  styleClass="noPrintButton" style="float: right;" />

                    <p:commandButton ajax="false" value="Print"  styleClass="noPrintButton" style="float: right;" >
                        <p:printer target="panelPrint" />
                    </p:commandButton>

                    <p:commandButton ajax="false" value="Excel"  styleClass="noPrintButton" style="float: right;" >
                        <pe:exporter type="xlsx" target="ins"  fileName="Caashier2" subTable="true" />
                    </p:commandButton> 

                    <p:panelGrid columns="4" style="min-width: 100%;border: none;">
                        <h:outputLabel value="From Date"/>
                        <p:calendar id="frmDate" value="#{cashSummeryController.fromDate}" navigator="true"  pattern="dd MMMM yyyy HH:mm:ss" >
                        </p:calendar>

                        <h:outputLabel value="To Date"/>
                        <p:calendar id="toDate" value="#{cashSummeryController.toDate}" navigator="true" pattern="dd MMMM yyyy HH:mm:ss" >
                        </p:calendar>
                    </p:panelGrid>
                </f:facet>


                <p:dataTable value="#{cashSummeryController.dailyCash3}" var="i" sortBy="#{i.item.institution.id}" style="min-width: 100%;border: none;" >                                                       

                    <p:column headerText="Item Name" style="width: 300px;">
                        <h:outputLabel value="#{i.item.name}"/>                        
                    </p:column>

                    <p:column headerText="Item Department" style="width: 300px;">
                        <h:outputLabel value="#{i.item.department.name}"/>
                    </p:column>
                    <p:column headerText="Item Category" style="width: 300px;">
                        <h:outputLabel value="#{i.item.category.name}"/>
                    </p:column>
                    <p:column headerText="Item Code" style="width: 150px;">
                        <h:outputLabel value="#{i.item.code}"/>
                    </p:column>
                    <p:column headerText="Count" style="width: 150px;">
                        <h:outputLabel value="#{i.count}"/>
                    </p:column>
                    <p:column style="width: 100px;text-align: right;">
                        <f:facet name="header">
                            <h:outputLabel value="Hospital Fee" style="float: left;"/>
                        </f:facet>
                        <h:outputLabel value="#{i.hospitalFee}" style="text-align: right;">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputLabel>                                        
                    </p:column>
                    <p:column style="width: 100px;text-align: right;">
                        <f:facet name="header">
                            <h:outputLabel value="Professional Fee" style="float: left;"/>
                        </f:facet>
                        <h:outputLabel value="#{i.proFee}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputLabel>
                    </p:column>
                    <p:column style="width: 100px;text-align: right;">
                        <f:facet name="header">
                            <h:outputLabel value="Total" style="float: left;"/>
                        </f:facet>
                        <h:outputLabel value="#{i.total}">
                            <f:convertNumber pattern="#,##0.00"/>
                        </h:outputLabel>
                    </p:column>


                    <p:summaryRow >
                        <p:column colspan="5"/>
                        <p:column style="text-align: right;">
                            <h:outputLabel value="#{cashSummeryController.hosTotal}">
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>                                            
                        </p:column>
                        <p:column style="text-align: right;">
                            <h:outputLabel value="#{cashSummeryController.profTotal}">
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>                                            
                        </p:column>
                        <p:column style="text-align: right;">
                            <h:outputLabel value="#{cashSummeryController.hosTotal+cashSummeryController.profTotal}">
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>                                            
                        </p:column>
                    </p:summaryRow>
                </p:dataTable>     


                <br/>

          

                <ca:agentCollection controller="#{cashSummeryController}"/>

                <ca:creditCompanyCollection controller="#{cashSummeryController}"/>                                     

                <br/><br/>              


                <p:panel >                       
                    <f:facet name="header">
                        <p:panelGrid columns="2" style="min-width: 100%;">

                            <h:outputLabel value="Collection For the Day"/>
                            <p:outputLabel value="#{cashSummeryController.grantTotal3}" style="text-align: right;float: right;font-weight: bold;">                        
                                <f:convertNumber pattern="#,##0.00"/>
                            </p:outputLabel>

                            <p:outputLabel value="Petty cash Payments : "/>
                            <p:outputLabel value="#{cashSummeryController.pettyTot}"  style="text-align: right;float: right;font-weight: bold;" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </p:outputLabel>

                        </p:panelGrid>
                    </f:facet>
                    <br/><br/>

                    <ca:departmentPayment controller="#{cashSummeryController}"/> 

                    <br rendered="#{cashSummeryController.departmentPayment.size()!=0}"/> 

                    <p:panelGrid columns="2" style="min-width: 100%;" >
                        <p:outputLabel value="BHT Professional Payment" rendered="#{cashSummeryController.bhtProfTot!=0}"/>
                        <p:outputLabel value="#{-cashSummeryController.bhtProfTot}" style="float: right;" rendered="#{cashSummeryController.bhtProfTot!=0}"/>
                        <p:outputLabel value="GSB Professional Payment" rendered="#{cashSummeryController.gsbProfTot!=0}"/>
                        <p:outputLabel value="#{-cashSummeryController.gsbProfTot}" style="float: right;" rendered="#{cashSummeryController.gsbProfTot!=0}"/>                            
                    </p:panelGrid>


                    <ca:creditCard controller="#{cashSummeryController}" />

                    <ca:slip controller="#{cashSummeryController}"/>

                    <ca:cheque controller="#{cashSummeryController}"/>                      

                </p:panel>  

                <br/> <br/>                         

                <p:panelGrid columns="2" style="min-width: 100%" >

                    <p:outputLabel value="&nbsp;"/>
                    <p:outputLabel value="&nbsp;" />
                    <p:outputLabel value="Net Cash : "/>
                    <h:outputLabel value="#{cashSummeryController.netCash}" style="float: right;font-weight: bolder;">
                        <f:convertNumber pattern="#,##0.00"/>
                    </h:outputLabel>
                    <p:outputLabel value="Lab Handover Total :"/>
                    <p:outputLabel value="......................." style="float: right;font-weight: bolder;">                          
                    </p:outputLabel>
                    <p:outputLabel value="Final Cash "/>
                    <h:outputLabel value="......................." style="float: right;font-weight: bolder;">

                    </h:outputLabel>
                </p:panelGrid>
            </p:panel>

            <br/><br/>

            <p:panel>
                <p:panelGrid columns="2" style="min-width: 100%;">

                    <f:facet name="header">
                        <p:outputLabel value="Bank Deposit"/>
                    </f:facet>

                    <p:outputLabel value="People Bank"/>
                    <p:outputLabel value="..............." style="float: right;"/>
                    <p:outputLabel value="HNB 1"/>
                    <p:outputLabel value="..............." style="float: right;"/>
                    <p:outputLabel value="HNB 2"/>
                    <p:outputLabel value="..............." style="float: right;"/>
                    <p:outputLabel value="BOC"/>
                    <p:outputLabel value="..............." style="float: right;"/>
                    <p:outputLabel value="NSB"/>
                    <p:outputLabel value="..............." style="float: right;"/>
                    <p:outputLabel value="&nbsp;"/>
                    <p:outputLabel value="&nbsp;" style="float: right;"/>
                    <p:outputLabel value="B/F Cash Ballance"/>
                    <p:outputLabel value="..............." style="float: right;"/>
                </p:panelGrid>
            </p:panel>

        </h:form>
    </ui:define>


</ui:composition>
